package com.auxgroup.smarthome.app.controller;

import com.auxgroup.bridge.app.inner.vo.PushRecordVo;
import com.auxgroup.smarthome.app.service.ConsumerPushRecordService;
import com.auxgroup.smarthome.app.service.inner.PushRecordInnerService;
import com.auxgroup.smarthome.web.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by root on 17-10-16.
 */
@Api(description = "推送记录", tags = "推送记录")
@RestController
@RequestMapping("/pushRecord")
public class ConsumerPushRecordController {

    @Autowired
    private PushRecordInnerService pushRecordInnerService;

    @Autowired
    private ConsumerPushRecordService consumerPushRecordService;

    @ApiOperation(value = "获取推送记录", notes = "获取推送记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "uid", paramType = "path", dataType = "string", required = true),
            @ApiImplicitParam(name = "time", value = "time 格式YYYY-mm-dd HH24:mi:ss", paramType = "query", dataType = "string", required = true),
    })
    @RequestMapping(value = "/list/{uid}", method = RequestMethod.GET)
    public ApiResponse<List<PushRecordVo>> findAllByUid(@PathVariable String uid, @RequestParam(value = "time") String time) {
        return pushRecordInnerService.findAllByUid(uid, time);
    }


    //获取推送记录返回json格式修改 修改人：吴建龙 修改日期：2018-05-12
    @ApiOperation(value = "获取推送记录new", notes = "获取推送记录new")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "uid", paramType = "path", dataType = "string", required = true),
            @ApiImplicitParam(name = "time", value = "time 格式YYYY-mm-dd HH24:mi:ss", paramType = "query", dataType = "string", required = true),
    })
    @RequestMapping(value = "/listNew/{uid}", method = RequestMethod.GET)
    public ApiResponse findAllByUidNew(@PathVariable String uid, @RequestParam(value = "time") String time) {
        return consumerPushRecordService.findConsumerPushRecord(uid, time);
    }


}
